@extends('admin.base')
@section('title', '商品列表')
@section('content')
    <div class="layui-card">
    <span class="pull-left">
        <a class="layui-btn-sm" style="cursor:pointer;" onclick="reload('{:url('Index/home')}');">首页</a>&raquo;<a class="layui-btn-sm" style="cursor:pointer;" onclick="refresh();" >规格类型列表</a>
    </span>
    <hr>
    
    <div class="layui-card-header">
        <div>
            <span class="pull-left">
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-inline">     
                            <label class="layui-form-label">关键字</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="sub_keywords" name="keywords"   placeholder="规格类型名">
                               
                            </div>
                            <div class="layui-input-inline">        
                                <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="selectsub" ><i class="layui-icon layui-icon-search"></i>查询</button> 
                            </div>        
                        </div>
                    </div>
                </div>
            </span>
            
            <span class="pull-right">
                <button class="layui-btn layui-btn-sm" onclick="active('{{url('admin/attrkey/add')}}','','添加');">
                    <i class="layui-icon">&#xe608;</i> 添加规格
                </button>
            </span>
        </div>
    </div>
    <div class="layui-card-body">
        <style>
            table tr td.tc,table tr th.tc {
                text-align: center;
            }
        </style>
        <table class="layui-table" lay-even lay-size="sm">
            <colgroup>
                <col width="50">
                <col width="100">
                <col width="200">
                <col width="100">
            </colgroup>
            
            <thead>
                <tr>
                    <th class="tc">ID</th>
                    <th class="tc">规格名</th>
                    <th class="tc">操作</th>
                </tr>
                <tbody>
                    @foreach($list as $vo)
                        <tr>
                            <td class="tc">{{$vo->id}}</td>
                            <td class="tc">{{$vo->kname}}</td>
                            <td class="tc">
                        <button class="layui-btn layui-btn-warm layui-btn-xs" title="修改" onclick="active('{{url('admin/attrkey/edit')}}','{{$vo->id}}','修改');">
                                    <i class="layui-icon">&#xe642;修改</i>
                                </button>
                                 <a class='home' href="{{url('admin/attrval/index?id='.$vo->id)}}" name="" >查看属性</a>
                               <!--  <button class="layui-btn layui-btn-xs" title="查看属性" onclick="active('{{url('admin/attrval/index')}}','{{$vo->id}}','查看属性');">
                                    <i class="layui-icon">查看属性</i> 
                                </button> -->
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </thead>
        </table>
        <!-- 分页 -->
        <div class="sabrosus" >{{$page}}</div>
    </div>
</div>

@endsection

@section('script')
    <script type="text/javascript">
    //搜索
    page_load();
    layui.use('form', function(){
        let form = layui.form;  
        form.on('submit(selectsub)', function(data){
            let keywords = $('#sub_keywords').val();//关键字
            
            reload("?keywords="+keywords);
            return false;
        });
    });
    //删除
    /*
    function del(url,id){
        layer.confirm('确定删除？', {
            icon: 3,
            title:'提示框',
            btn: ['确定','取消'] //按钮
        },function(){
            $.post(url,{id: id},function(data){
                if(data.code == 1){
                    layer.msg('删除成功！');
                    refresh();
                }else{
                    layer.msg('未找到指定数据！');
                }        
            });
        });
    }
    */
</script>
@endsection